﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace PointAsLine{
    public class PointFFunc
    {
        // 计算两点之间的欧几里得距离
        public static float Distance(PointF p1, PointF p2)
        {
            float dx = p1.X - p2.X;
            float dy = p1.Y - p2.Y;
            return (float)Math.Sqrt(dx * dx + dy * dy);
        }

        internal static float Distance(PointF2G p1, PointF2G p2)
        {
            float dx = p1.X - p2.X;
            float dy = p1.Y - p2.Y;
            return (float)Math.Sqrt(dx * dx + dy * dy);
        }
        public static PointF2G Sub(PointF2G a, PointF2G b)
        {
            return new PointF2G(a.X - b.X, a.Y - b.Y);
        }
        public static float MeterToPixel(double meter)
        {
            return (float)(meter * 512.0 / 200);
        }
    }
}
